import axios from 'axios'
import url from '../../util/url'
const pl = {
	namespaced: true,
	state: {
		list: [],
		gnameList: [],
		total: 0,
		pageSize: 3,
		currentPage: 1
	},
	mutations: {},
	actions: {
		getList({ state }) {
			axios({
				method: 'get',
				url: url + 'api.php/records/reply',
				params: { order: 'id,desc', page: state.currentPage + ',' + state.pageSize }
			}).then(res => {
				state.list = res.data.records
				state.total = res.data.results
			}).catch()
		},
		changePage({ state, dispatch }, page) {
			state.currentPage = page
			dispatch('getList')
		},
		del({dispatch},id){
			axios({
				method:'delete',
				url:url+'api.php/records/reply/'+id
			}).then(()=>{
				dispatch('getList')
			}).catch()
		}
	}
}
export default pl